<?php
session_start();
 if(!isset($_SESSION['fl']))
{
	header("Location:booking.php");
}
$s=$_SESSION['$user'];



?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Success Payment</title>
<?php
$con=mysql_connect('localhost','root','');
if(!$con)
{
  die('could not connect:'.mysql_error());
  }
  mysql_select_db("ETrawelMart",$con);
  
  
  
  $paymenttype=$_POST['paymenttype'];
  $cardname=$_POST['cardname'];  
 $y=$_POST['y'];
 $m=$_POST['m'];
 $d=01;
  $doe=date('Y-m-d',mktime(0,0,0,$m,$d,$y));
  $cardno=$_POST['cardno'];
  $cvv=$_POST['cvv'];
  
  
  $tripname=$_SESSION['tripname'];
  $tripcode=$_SESSION['tripcode'];
  $no_of_pass=$_SESSION['no_of_pass'];
  $veg=$_SESSION['veg'];
  $non_veg=$_SESSION['non_veg'];
  $yn=$_SESSION['yn'];
  
  $ty=$_SESSION['ty'];
 $tm=$_SESSION['tm'];
 $td=$_SESSION['td'];
 
 $dot=date('Y-m-d',mktime(0,0,0,$tm,$td,$ty));
  $tot_cost=$_SESSION['tot_cost'];
    $sql="INSERT INTO customer_booking(user_id,tripcode,tripname,passengers,veg,non_veg,insurance,date_of_travel) VALUES('$s','$tripcode','$tripname','$no_of_pass','$veg','$non_veg','$yn','$dot')"; 
 
 
  $sql1="INSERT INTO payment(user_id,paymenttype,cardname,cardno,cvv,doe,tot_cost) VALUES('$s','$paymenttype','$cardname','$cardno','$cvv','$doe','$tot_cost')";
  
  if(!mysql_query($sql,$con))
  {
  die('error:'.mysql_error());
  }
  
  if(!mysql_query($sql1,$con))
  {
	  die('error'.mysql_error());
  }
  
  
  mysql_close($con);
 session_destroy();
  ?>
 
<script language="javascript"> 
		 alert("Payment successful, please check your mail to knw the payment details"); window.location.href='home.html'; </script> 
</head>

<body>




</body>
</html>
